<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <button id="btn1">本地存储：ipcName为ipc1</button>
  <button id="btn2">sessionStorage会话存储：id为111222333</button>
  <button id="btn3">本地存储：清除ipcName的key</button>
  <script>
    let btn1 = document.getElementById('btn1')
    let btn2 = document.getElementById('btn2')
    let btn3 = document.getElementById('btn3')
    btn1.addEventListener('click', () => {
      localStorage.setItem('ipcName', 'ipc1')
    })
    btn2.addEventListener('click', () => {
      sessionStorage.setItem('id', '111222333')
    })
    btn3.addEventListener('click', () => {
      // 本地存储，清除某个key
      localStorage.removeItem('ipc')
      // 清除所有的key
      localStorage.clear()
    })
  </script>
</body>
</html>